Focus detecting device

ABSTRACT

In a focus detection system for detecting focus condition of an objective lens, there is disposed a pair of photo sensor arrays each having a plurality of photo cells lined up in one direction to receive a first image and second image passed through respectively a lens system and the photo sensor arrays produce first original signal groups and second original signal groups each signal groups corresponding to light intensity of the images projected thereto. A processing device processes the original signal groups in such a manner that the first original signal groups are respectively divided into a plurality of blocks, and one of the blocks of the first original signal groups is selected and it is detected that in what group in the selected block best coincidence occurs.

This is a division of application Ser. No. 628,921, filed on Nov. 29,1990, for a FOCUS DETECTING DEVICE, which is a continuation ofapplication Ser. No. 338,389, filed on Apr. 11, 1989, which is acontinuation application of Ser. No. 120,550, filed on Nov. 12, 1987(abandoned), which is a division of application Ser. No. 735,569, filedon May 7, 1985, and issued as U.S. Pat. No. 4,766,302 on Aug. 23, 1988.

FIELD OF THE INVENTION

The present invention relates to a focus detecting device, and moreparticularly to a device for detecting a focused condition of aphotographic lens system by way of detecting a relative displacement ofimages projected on a pair of photo sensor arrays.

BACKGROUND OF THE INVENTION

In order to detect the direction of defocus and the amount thereof,there is known such an arrangement that light of a photographic objectis passed a photographic lens and to form two light images of theobject, which are passed two regions existing symmetrical with respectto the light axis of the lens, thereby reforming two light images on twoplanes, so that a displacement and a direction between the positions ofthe two focused light images from a predetermined focused position aredetected for determining the photographic lens is in the in-focusposition, front focus position or rear focus position. FIGS. IA and IBshow an example of the arrangement for the method described above,wherein behind the photographic lens 2, a condenser lens 4 is placed onthe predetermined focal plane 4 or backward therefrom. Re-forming lenses8 and 10 are placed behind the condenser lens 4 and first and secondphoto line sensor arrays 14 and 16 are disposed. By the arrangement, incase of a front focus condition, light images projected on the photosensor arrays 14 and 16 come near the optical axis and in case of a rearfocus condition, the light images leave away from the optical axis. Incase of an in-focus condition, the two light images are projected on thepredetermined positions defined by the optical system of the focussensing device. Therefore, by detecting the distance between the twolight images on the photo sensor arrays, the focused condition of thephotographic lens can be detected.

In FIGS. 2(a) through 2(c), light image patterns projected on the firstand second photo sensor arrays 14 and 16 are shown. The first photosensor array 14 (referred to as the standard photo sensor arrayhereinafter) consists of photo cells L1 through L9 and the second photosensor array 16 (referred to as the reference photo sensor arrayhereinafter) consists of photo cells R1 through R21 lined up in ahorizontal direction with a predetermine space S on the both sides of acenter line 18. The center line 18 is determined so that the opticalaxis of the photographic lens 2 passes through it. Patterns of the lightintensity of the images projected on the standard and reference photosensor arrays 14 and 16 are designated by LIm and RIm. FIG. 2(a) showsthat the image pattern RIm1 which coincides with the image pattern LIm1projected on the standard photo sensor array 14 is positioned on photocells R7 through R15 of a reference photo sensor array 16. It is assumedthat FIG. 2(a) shows an in-focus condition. In case of FIG. 2(a), theoutput value of each photo cells L1 through L9 of the standard photosensor array 14 is equal to the output value of each photo cells R7through R15 of the reference photo sensor array 16 respectively.Therefore L1-R7=0, L2-R2=0, . . . L9, OR15=0, wherein L1, L2, . . . L9,R7, R8, . . . R15 are output values of the respective photo cells L1through L7 and R7 through R15. In addition, |L1-R7|+|L2-R8|+. . .|L9-R15|=0. As mentioned above, in a case where two images coincide eachother, the difference between the corresponding two photo cells is 0 andthe sum of each difference is also 0. In practice, since the photosensing characteristics of the respective photo cells ar different fromcell to cell, the result of the subtraction and the total sum can not bezero but can be minimum if the degree of the coincidence between twoimages is highest.

In case of a front focus condition, as shown in FIG. 2(b), the imagepattern RIm2 which is projected on the reference photo sensor array 16and coincides with the image pattern LIm2 projected on the standardphoto sensor 14 is projected on the photo cells R1 through R9. In caseof a rear focus condition, as shown in FIG. 2(c), the image pattern RIm3which is projected on the reference photo sensor array 16 and coincideswith the image pattern LIm3 projected on the standard photo sensor 14 isprojected on the photo cells R13 through R21 In order to detect theprojected position of the image pattern RIm on the reference photosensor array 16, the image pattern LIm on the photo cells L1 through L9of the standard photo sensor array 14 is compared with the image patternRIm on the photo cells R1 through R9 of the reference photo sensor array16, thereafter the image pattern LIm on the photo cells L1 through L9 iscompared with the image pattern on the photo cells R2 through R10. In asimilar manner, the image pattern is taken from the respective photocells of the reference photo sensor array 16 by shifting right by onephoto cell, then the respective image patterns thus taken are comparedwith the image pattern LIm so that results of comparison of thirteensets can be obtained. Defining H(1) as the result of the comparison interms of the image pattern on the photo cells R1 through R9, the resultcan be expressed. ##EQU1##

In a similar manner, the result H(2) of the comparisons in terms of thephoto cells R2 through R10 is expressed ##EQU2##

By the calculation mentioned above, thirteen results of the comparisonsH(i), wherein i=1,2, . . . ,13 (referred to as relative valuehereinafter) can be obtained.

By finding the minimum relative value Hmin(n) among H(1) through H(13),the number n represents the result of the comparison wherein both imagepatterns LImn and RImn coincides best. For example, in case of FIG.2(a), the minimum relative value occurs at the number n=7. In case ofFIGS. 2(b) and 2(c), the minimum relative values occurs at the numbersn=1 and n=13. The amount of the displacement of FIGS. 2(b) and 2(c)against FIG. 2(a) is -6(=1-7), 6(=13-7) on the pitch of the photocellsbasis, then the amount of the displacement can be obtained.

By providing 9 photo cells of the standard photo sensor array 14 and 21photo cells of the reference photo sensor array 16, the defocuscondition can be detected in the range of plus minus 6 pitches. In orderto expand the detectable range cf defocus, one way is to increase thenumber of the photo cells of the reference photo sensor array 16 againstthe number of the photo cells of the standard photo sensor array 14. Inorder to expand the detectable range of the defocus with the 21 photocells of the reference photo sensor array, it is required to decreasethe number of the photo cells of the standard photo sensor array 14. Forexample, detection of the defocus can be made with 7 pitchs byeliminating the photo cells L1 and L9. Decreasing the number of thephoto cells, however, causes the accuracy of the defocus detection to belowered.

In order to eliminate the disadvantage described above, U.S patentapplication Ser. No. 540,012 discloses a method of detecting the defocuswith a high accuracy as shown in FIG. 3. In FIG. 3, there are added forphoto cells La, Lb, Lc and Ld to the standard photo sensor array 14shown in FIG. 1. Using the output of 13 photo cells La through Ld inaddition to the photo cells L1 through L9, the defocus can be detectedwith the range of +4 pitches of the photo cells. Compared with thearrangement of FIG. 2, the defocus detecting range of the arrangementshown in FIG. 3 is smaller by +2 pitches of the photocells, thereby theaccuracy of the comparison can be improved.

In order to detect the defocus greater than 4 pitches of the photocells, defocus as shown in FIG. 3(b) can be detected using seven photocells L5 through Ld. FIG. 3(b) shows that the image pattern is displacedby 10 pitches of the photo cells relative to the in-focus conditionshown in FIG. 3(a). In other word, by using the output of the photocells L5 through Ld of the arrangement shown in FIG. 3, the front focuscondition defocused by 10 pitches of the photo cells can be detected. Tothe contrary, using the output of the photo cells La through L5 enablesto detect the rear focused condition defocused backwardly by 10 pitches.In the arrangement of FIG. 3, the accuracy of the defocus detection maybe decreased due to decrement of the number of the photo cells. However,this may be negligible because in case of a large defocus, it is enoughto detect a rough value of the defocus first, then the objective lens ismoved to near the in-focus position on the basis of the detected defocusvalue, subsequently a fine focusing detection is made using the outputof the photo cells La through Ld.

In the focus detection, at first, the position of the photographic lensis not preliminarily known, therefore one problem is to decide whatphoto cell outputs among the group I, II, III shown in FIG. 3 are usedat first as the standard. In the U.S. patent application Ser. No.570,012 defocus detection is made first for the all groups I, II andIII, then the minimum relative value Lmin (n) is detected so as toselect any one of the groups I,II, III in which the minimum relativevalue occurs. In the above method, the defocus detection for the groupsI,II and III must be made even if the photographic lens is situated nearthe focused position, therefore such operation is apparentlyunnecessary.

SUMMARY OF THE INVENTION

The present invention is to provide a defocus sensing device withoutunnecessary operation and arrangement.

According to the present invention there is provided a focus detectionsystem for detecting focus condition of an objective lens, comprising;

optical means for receiving objective light having passed through saidobjective lens at its two positions distant from the optical axis of theobjective lens, to form first and second object images in such a mannerthat the distance between said first and second object images in thedirection perpendicular to the optical axis varies with the focuscondition of an object image by said objective lens on a predeterminedfocal plane,

means, including a pair of photo sensor arrays each having a pluralityof photo cells lined up in one direction and disposed to receive thefirst image and second image respectively for producing first originalsignal groups and second original signal groups each signal groupscorresponding to light intensity of the images projected thereto,

means for dividing the first original signal groups into a plurality ofblocks,

means for selecting one of the blocks of the first original signalgroups which is coincided with predetermined group of the secondoriginal signal group most, when the objective lens is in in-focuscondition, and for comparing the second original signal groups of thepredetermined group with the signal group in the selected block of thefirst original signal group shifting the photo cells in a predetermineddirection, and

means for detecting in what group in the selected block, bestcoincidence occurs.

BRIEF DESCRIPTION OF THE DRAWINGS

FIGS. 1B and 1A are schematic diagram showing an example of a focusdetecting device used in the present invention,

FIGS. 2(a) through 2(c) and FIGS. 3(a) through 3(c) are schematicdiagrams showing the principle of the operation of the device shown inFIG. 1A,

FIGS. 4(a) and 4(b) are enlarged front view of a photo sensor arraysused in the embodiment of the present invention,

FIGS. 5(a), 5(b), 11, 13 and 15 are respectively circuit diagramsshowing one embodiment of the focus detecting device according to thepresent invention,

FIGS. 6, 12 and 14 are flow charts showing operation of the circuitarrangements shown in FIGS. 5(a), 5(b), 11, 13 and 15,

FIG. 7 shows a graph showing a principle of using a minimuminterpolation shift value,

FIG. 8 is a graph showing an example of output of the photosensor array,

FIGS. 9(a) through 9(d) are graphs showing various relations of theshift value and co-relation value,

FIG. 10 is a schematic diagram showing one example of a way of obtainingthe minimum shift value Y2 by an interpolation method,

FIGS. 16(a) and 16(b) are schematic diagram showing one way of obtainingthe minimum interplation shift value,

FIG. 17 is a schematic diagram showing number lines of the shift valueand displacement, and

FIG. 18 is a block diagram of a automatic focus control circuit used inthe embodiment of the present invention.

DETAILED DESCRIPTION OF PREFERRED EMBODIMENTS

Referring to FIG. 4(a), in place of using two photo sensor arrays 14 and16 in the arrangement shown in FIGS. 1 and 2, one photo sensor arraysuch as a CCD line image sensor array is used by assigning two differentportions of the CCD line image sensor array to the standard andreference photo sensor arrays 14 and 16. In FIG. 4(a), X denotes theposition through which the optical axis of the photographic lens passes.It is noted that photo cells near the position X are not used. l1through l23 denote photo cells of the standard photo sensor array 14.The standard photo sensor array 14 is divided into a first block Iconsisting of the cells l1 through l16, a second block II consisting ofthe cells l1 through l23 and a third block III consisting of the cellsl8 through l23. The first and third blocks I and III have 16 photo cellsand the second block II has 23 photo cells. A light receiving element(not shown) is disposed above the standard photo sensor array 14 formonitoring the intensity of light projected thereto.

r1 through r31 are photo cells of the reference photo sensor array 16having 31 photo cells more than the number of the photo cells of thestandard photo sensor array 14. L1 is a distance between the photo celll1 of the standard situated furthest from the optical axis X and thephoto cell r1 of the reference photo sensor array 16 nearest to theoptical axis X. When the photographic lens exists at the in-focusposition in the predetermined focus plane, the image projected to thephoto cells l1 through l23 of the block II of the standard photo sensorarray 14 coincide with the image projected to the photo cells r5 throughr27 of the reference photo sensor array 16. The block consisting of thephoto cells r5 through r27 is referred to as in-focus block F. Distancebetween the photo cell l12 situated at the center of the second block IIof the standard photo sensor array 14 and the photo cell r16 situated atthe center of the in-focus block F of the reference photo sensor array16 is referred to as an image distance L2 when the in-focus condition isdetected.

FIG. 5(a) shows one example of a control circuit used in the preferredembodiment of the focus sensing device according to the presentinvention, in particular there is shown mainly a circuit arrangement Afor processing the output data from the sensor arrays 14 and 16 so as todetect the relation between the output data of the second block II ofthe standard photo sensor array 14 and the output data of the referencephoto sensor array 16. Both of the photo sensor arrays 14 and 16 areexpressed by Se in FIG. 5(a) and the integrated output data of eachphoto cells is converted into data in a digital form. An operationthereof is shown in FIG. 6. Upon detection of the closure of an AF (autofocus operation) switch (at the step S1 of FIG. 6), current flowing eachof the photo cells of the photo sensor arrays Se is integrated in thestep S2 and in turn the integrated current is damped in the step S3subsequently in the step S4 the damped analog data of the respectivephoto cells are sequentially converted into digital form by the A-Dconverter 20. The integrated data Si of each of the photo cells l1through l23 and r1 through r31 is sequentially compared with apredetermined standard value a1 (at the step S5) by a comparator 22 fordetecting whether or not the integrated data Si is larger or smallerthan the predetermined value al. If any one of the integrated data Si isgreater than the standard value a1, a flag F2 is set to 1 in the stepS6. In case where all of the integrated data Si is smaller than thestandard value a1, the flag F1 is kept reset to 0. The comparator 22 andthe flag F1 act as a brightness detecting means for detecting whether ornot the brightness level of an photographic object exceeds thepredetermined value, whereby in a case where the output of any one ofthe photo cells l1 through l23 or r1 through r31 exceeds the standardvalue a1, the flag F1 is set for judgement that there is a sufficientbrightness of the object for the focus detection.

In the step S7, the integrated data Si of the respective photo cells l1through l23 and r1 through r31 are stored in a memory device 24 made ofRAM so that the respective integrated data of the photo cells l1 throughl23 and r1 through r31 are stored in the corresponding address of theRAM 24. It is noted that l1 through l23 and r1 and r31 represent theoutput value of each of the photo cells l1 through l23 and r1 and r31. Acalculation circuit 26 calculates the following equation; ##EQU3##wherein the suffix 2 in H₂ means that the second block II of thestandard photo sensor array 14 is used, N is 1, 2, . . . 9.

When N=1 the equation (1) is expressed

    H.sub.2 (1)=1/2|l1-r1|+|l2-r2|+. . . +|l22-r22|+1/2|l23-r23|(2)

Namely, the equation (2) represents to calculate the absolute value ofthe difference of the output of the photo cells l1 and r1, . . . theabsolute value of the difference of the output of the photo cells l23and r23 and with the outputs of both ends of the photo cells divided by2, then calculate the total value.

When N=2, the equation (1) is expressed

    H.sub.2 (2)=1/2|l1-r2|+|l2-r3|+. . . +|l22-r23|+1/2|l23-r24 |(3)

Namely, the equation (3) represents to calculate the absolute value ofthe difference of the output of the photo cells, shifting the respectivecells l1 through l23 of the second block II relative to the referencephoto sensor array 16 by one cell compared to the case of H₂ (1),thereby calculating the relative value between corresponding two photocells such as l1 and r2, l2 and r3 . . . , then the total sum iscalculated with the both ends divided by 2. Similarly for the N=3,4,5 .. . ,9, shifting the respective cells l1 through l23 of the second blockII relative to the reference photo sensor array 16 by 2,3, . . . 8 cellscompared to the case of H₂ (1) thereby calculating the relative valuebetween corresponding two photo cells such as l1 and r3, l2 and r4 . . ., then the total sum is calculated with the both ends divided by 2. Itis noted that H₂ (N) is referred to as a comparative data and N shiftvalue. By the calculation mentioned above, there can be obtained ninekinds of the comparative data by changing shift value from 0(corresponds to N=1) to 8 (corresponding to N=9). The comparative databecomes 0 when the light image patterns projected to the respectivephoto sensor arrays 14 and 16 are exactly the same. The larger thedisplacement of the light image patterns, the comparative data becomeslarger.

Division by 2 of the absolute value of the difference of the data of theboth end photo cells decreases the contribution of the value of the bothend photo cells to the comparative data. H₂ (N) as hereinafterexplained.

The comparative data H₂ (N) is stored in the RAM 28 with the shift valueN. The minimum value among the 9 comparative data H₂ (N) can be detectedby a minimum value detector 30.

The minimum comparative data is expressed as H₂ (n) and the shift valueby which the minimum comparative data occurs is expressed as a minimumshift value n. (n is any one of 1, 2, 3, . . . 9). The minimumcomparative data H₂ (n) and the minimum shift value n are respectivelystored in the RAM 32.

A calculation circuit 34 calculates the following equations; ##EQU4## onthe basis of the integrated data l1, l2 . . . l23 and r1, r2 . . . r31,the minimum comparative data H₂ (n) and the minimum shift value n storedin the RAM32.

The calculation mentioned above is to increase the accuracy of thedetection of the interval of the image. Assuming, for example, that theshift value N and the comparative data H₂ (N) have the relation as shownin FIG. 7. In this case, the minimum comparative data H₂ (n) is H₂ (3)with the minimum shift value n. However, in practice, the comparativedata H₂ (N) may be changed along the dotted line. Under such situation,there occurs an error when the image interval is detected using n=3.That is to say, if the minimum shift value n is directly used for theimage interval detection, the detection can be made in a cell to cellspace basis, therefore accuracy finer than the cell space can not beobtained. The finer accuracy can be expected if the space of the cellsis decreased. However this method is not practical because there is alimit in decreasing the space of the cell of the CCD sensor array inmanufacturing thereof. In order to solve this problem, the preferredembodiment of the present invention is so arranged as to detect afurther minimum comparative value smaller than the minimum value H₂ (n)in a position between n and n+1 so that the image interval can bedetected with a finer accuracy.

Assuming that the comparative data H₂ (N) becomes minimum when N=3,i.e., the minimum comparative data is H₂ (3) with n=3. According to theequation (1), H₂ (3) is expressed as follows,

    H.sub.2 (3)=1/2|l1-r3|+l2-r4|+|l3-r5|+. . . |l22-r24|+1/2|l23-r25|(6)

On the other hand, by the equation (4),

    h.sub.2 (2)=|l2-r3|+l3|r4|+. . . +|l23-r24|                              (7)

can be obtained. Also by the equation (5),

    h.sub.2 (4)=|l1-r4|+|l2-r5|+. . . +|l22-r25|                              (8)

can be obtained.

Comparing each term of the equation (6) with each corresponding term ofthe equations (7) and (8) with both end terms of the equation (6)neglected, it can be found that there can be obtained one comparisondata h₂ (2) for the shift value n-1 (n=2) and another comparison data h₂(4) for the shift value n+1 (n=4). It is noted that in place of dividingboth end terms by 2, equations (7) and (8) are calculated with the oneterm omitted.

Accordingly, the scale of the result of h₂ (3) is equal to the scale ofh₂ (2) and h₂ (4), so that it is possible to compare the value h₂ (2)with h₂ (4) without modifying by a factor.

Following is an explanation of a reason why obtaining the comparisondata smaller than H₂ (3) using h₂ (n-1) and h₂ (n+1) with reference toFIG. 8.

In FIG. 8, the horizontal axis represents the number k of the photocells and the vertical axis the output thereof. The line α1 representsthe output of the photo cells l1 through l23, α2 denotes outputs of thephoto cells rt through rt+22 which receive the light image having thehighest relative value, wherein t=1, 2, . . . 9.

On the other hand, the line α3 represent the outputs of the photo cellsrt-1 through rt-1+22. Assuming the the relative value between the imageon the photo cells l1 through l23 and the photo cells r5 through r27 isthe highest, then t=5 and the dotted line α2 represents the outputs ofthe photo cells r5 through r27.

The co-relation degree I(1) between the photo cells l1 through l23 andr1 through r23 can be expressed ##EQU5## The co-relation degree I(2) inwhich the outputs of the reference photo sensor array is displaced byone cell can be expressed ##EQU6## In a similar manner as describedabove, the co-relation degree values I(3) through I(9) can be obtained.

The highest co-relation degree I(5) can be expressed by the areasurrounded by the lines α1 and α2 in the interval between k=1 throughk=23.

The co-relation I(4) can be expressed as ##EQU7## and can be depicted bythe area surrounded by the lines α1 and α3 in the interval between k=1through k=23.

The co-relation I(6) can be expressed as ##EQU8## and can be depicted bythe area surrounded by the lines α1 and α4 in the interval between k=1through k=23.

As apparent from the graph shown in FIG. 8, the area S1 is not equal tothe area S2. It is noted that the areas S1 and S2 may be equal eachother if the lines α1, α2, α3 and α4 are linear. However, in practicethere may not occur such a case that an image becomes linear.

It is noted that why the area S1 is not equal to the area S2 is becausethe co-relation between the reference photo sensor array which theco-relation is taken is not equal to the interval k=1 through k=3 andk=21 through k=23 in terms of I(9) and I(10).

Taking both of the area S1 eliminating the area S3 which is the areasurrounded by the lines α1 and α3 within the interval k=1 through k=2and S2 eliminating the area S4 surrounded by the lines α1 and α4 withinthe interval k=22 and k=23, it is understood from the graphs shown inFIG. 8 that the following equation

    S1-S3=s2-S4                                                (13)

can be established.

The value S1-S3 and S2-S4 can be expressed by the following equation.##EQU9##

When the line d1 and d2 overlaps, the equation (13) can be established,but if not overlapped, the equation (13) can not be established. If thelines α1 and α2 do not overlap, there is a smaller degree of theinconsistency between the values of the equations (14) and (15) than thedegree of the inconsistency of the values of the equations (4) and (5).In other words, the former case has a better consistency.

Standing on the situation that it can be expected that when an imageprojected on one block of the standard photo sensor array is comparedwith the image of the reference photo sensor array and the co-relationdegree becomes highest at a given number of comparison, there occurs agood consistency of the result of the comparison by displacing one photocell, it is preferred to use the result of the equations (14) and (15)rather than the result of the equation (11) and (12).

By the result of the study as described above, according to the presentinvention, the result of the calculation of the equations (14) and (15)in the final process of detecting the focused position as the result ofthe comparison in terms of the forward or rearward of the one pitch ofthe photo cell for the highest co-relation.

Assuming that there can be obtained the minimum comparison data H₂ (n)at the minimum shift value, the results of the comparison h₂ (n-1) andh₂ (n+1) at the n-1 number and n+1 number can be expressed ##EQU10##Both of the result of the equations (16) and (17) are used theinformation for deciding the focused position.

Studying the equations (9) and (10), the left item of the equationsconsists of 23 terms. On the other hand, the left item of the equations(16) and (17) consists of 22 terms. There is a difference of one termbetween the number of the terms of the equations (9) and (16) or (10)and (17).

The equation (9) is shown again

    I(1)=|l1-r.sub.1 |+|l2-r.sub.2 |+. . . |l23-r.sub.23 |                         (9)

Adopting the following equation

    I(1)'=1/2|l1-r1|+|l2-r2|+. . . |l15-r15|+1/2|l23-r23|(18)

wherein the weight of the both ends of the equation is decreased by 1/2,the weight of the sum of the first term and the last term becomes 1, sothat it can be dealt that there are 22 terms of the weight of 1.Therefore, the equation (18) can be used for obtaining the result of thecomparison for the best coincidence in place of the equation (9).

The following equations can be calculated as to the first block, secondblock and third block respectively. ##EQU11##

There occur various relations of the magnitude between the result of theH₂ (n) obtained by the equations (4) and (5) and h₂ (n-1) and h₂ (n+1)wherein h₂ (n-1)≧H₂ (n) and h₂ (n+1)≧H₂ (n). These relations aredepicted in FIG. 9, wherein the horizontal axis represents the shiftvalue and the vertical axis the values of the equations H₂ (n), h₂ (n-1)and h₂ (n+1). FIG. 9(a) shows the case of h₂ (n-1)=h₂ (n+1), in thiscase the value H₂ (n) is truely minimum. FIG. 9(b) shows the case whereh₂ (n-1) is smaller than h₂ (n+1), in this case, there is a trueco-relation value between n and n-1. FIG. 9(c) shows the case where h₂(n-1) is greater than H₂ (n) which is equal to h₂ (n+ 1), in this casethe true co-relation value is present between n and n+1. FIG. 9(d) showsthe case where h₂ (n-1) is greater than h₂ (n+1), wherein the trueco-relation value is present between n and n+1. It is noted that FIGS.9(a) through 9(d) show the ideal cases with the true co-relation valueto be 0. However in practice, the true co-relation value is not 0 due tosuch as a lens aberration. In case where two minimum values of thecomparison data are detected as shown in FIG. 9c, the comparison datafor the smaller n is used. Accordingly there is not the case of H₂(n)=h₂ (n-1).

Returning to FIG. 5(a) again, the data h₂ (n-1) and h₂ (n+1) calculatedin the calculation circuit 34 are transferred to memory circuit 36 andstored therein. The minimum comparison data H₂ (n) stored in the memorycircuit 32 and h₂ (n+1) and h₂ (n-1) stored in the memory circuit 36 areinput to the calculation circuit 38 for calculation of the followingequation (22) in the step S11 shown in FIG. 6.

    Y2=H.sub.2 (n)-1/2|h.sub.2 (n-1)-h.sub.2 (n+1)|(22)

The equation above obtains the value Y2 in FIG. 7 of the comparison dataH₂ (N) in the minimum peak value. The value Y2 is referred to as theminimum peak. The suffix 2 represents that the detection is made in thesecond block II.

A method of obtaining the minimum peak Y2 is explained with reference toFIG. 10. Taking the horizontal axis for the shift value and the verticalaxis for the comparison data, the coordinates of the point D1corresponding to the minimum comparison data can be shown by (n, H₂(n)), the coordinates of the point D2 corresponding to h₂ (n-1) shows(n-1, h₂ (n-1)) and the point D3 corresponding to h₂ (n+1) shows (n+1,h₂ (n+1)). The straight line L1 connecting the points D1 and D2 can beexpressed using the coordinate of the both points and it is assumed thatthe peak P is situated on the straight line L1. It is further assumedthat the straight line L2 connecting the points P and D2 has a gradientwith the reversed sign against the line L1. Then the minimum peak P canbe obtained by the co-ordinate of the point at which the lines L1 and L2intersect together.

The minimum peak value Y2 thus obtained is stored in the memory circuit40. The minimum peak value Y2 can be used for judgement of whether ornot the minimum comparison data H₂ (n) using the second block II isreliable.

In the preferred embodiment of the present invention, there is provideda contrast detecting circuit 42 for detecting the contrast of the lightimages on the block II in order to judge the minimum comparison dataH2(n) detected using the block II is reliable. The contrast detectingcircuit 42 calculates the sum of the difference value of the output ofeach adjacent two photo cells in the block II as the contrast data C2 bythe following equation; ##EQU12## The suffix 2 represents the valueconcerning to the block II. The contrast value C2 is stored in thememory circuit 44. The contrast value stored in the memory circuit 44 isused for judging that the contrast of the object is sufficient for thefocus detection. In case where the contrast is too low, despite that thelight image projected on the photo cells on the second group II of thestandard photo sensor array 14 does not coincide with the light meansprojected on the reference photo sensor array 16, there erroneouslyobtained the minimum peak Y2 and the image interval is erroneouslydetected.

In order to eliminate this drawback, the contrast value C2 detected bythe contrast detecting circuit 44 is applied to a comparator 46 forjudging whether or not the contrast value C2 is greater than apredetermined constant a5 in the step S14 shown in FIG. 6. The constanta5 is so selected that the contrast value C2 is greater than theconstant a5 when the image of the photographic object has a sufficientcontrast for the focus detection. In case where the contrast value C2 isgreater than the constant a5 i.e., the contrast is sufficient to detectthe focused condition, a flag F5 is set to produce an output 1 by theoutput of the comparator 46. To the contrary with the contrast valuesmaller than the constant a5, i.e., the contrast is insufficient for thefocus detection, the flag F5 is made 0.

The contrast value C2 stored in the memory circuit 44 is input to acalculation circuit 48, in which the contrast value C2 is multipliedwith constants a2, a3 and a4 to obtain the values a2C2, a3C2 and a4C2and they are stored in the memory circuit respectively. The constantsa2, a3 and a4 are provided for setting a plurality of the judging levelsso as to make sure the comparison data H₂ (n) is reliable with referenceto the various conditions. The values a2, a3 and a4 has the relation ofa2<a3<a4. The values a2, a3 and a4 are respectively referred to as afirst judge level, a second judge level and a third judge level in theorder.

The judge levels a2C2, a3C2 and a4C2 are respectively input to thecomparator 50 so as to be compared with the magnitude of the minimumpeak Y2. In a case where the minimum peak Y2 is smaller than the firstjudge level a2C2, a flag F2 is set to 1 by the output of the comparator50. In a case where the minimum peak Y2 is smaller than the second judgelevel a3C2, a flag F3 is set to 1 by the output of the comparator 50. Ina case where the minimum peak Y2 is smaller than the third judge levela4C2, a flag F4 is set to 1 by the output of the comparator 50.

Since a2<a3<a4, when Y2 is equal to or smaller than a2C2, three flagsF2, F3 and F4 are set. With a3≦C2≦Y2≦a3C2, the flags F2 and F3 are set.With a3C2<Y2≦a4C2, the flag F4 alone is set. With a4C2<Y2, none of theflags F2, F3 and F4 is set. Through this operation, it is judged thatthe minimum peak is smaller than which judge levels.

A logic circuit shown in the right lower portion of FIG. 5(a) isprovided for judging the minimum peak is reliable according to a firstcondition of whether the brightness of the photographic object issuitable for the focus detection by judging whether or not the flag F1is set, a second condition of whether the contrast of the photographicobject is suitable by judging whether or not the flag F5 is set and athird condition of whether or not the previous focus detection in thenearest past was made correctly by judging whether or not a flag F15(described hereinafter) is set.

Referring to FIG. 6, in the steps S13 and S14, it is judged whether ornot the flag F1 is set and the flag F5 is set. In a case where any oneof the flags F1 and F5 is not set, the program flow goes to the step S15to set the flag F6. This is made in such a manner that if any one of theoutput of the flags F1 or F5 is "0", the output of an and gate AND1 is"0" and the output of a nand gage NAND 1 is "1" whereby a flag F6 isset. When the output of the nand gate NAND1 is "1", the output of theand gate AND2 corresponds to the state of the flag F2. Accordingly,under the set state of the flag F6 set by the "1" output of the NAND1,with Y2≦a2C2 and set state of the flag F2, the output of the and gateAND2 becomes "1", thereby the output of the or gate OR1 to be " 1". Onthe other hand, with Y2>a2C2 and the reset state of the flag F2, theoutput of the and gate AND2 is kept "0". Thus, the operation in the stepS15 can be performed.

In a case where both of the flags F1 and F5 are set and the output ofthe and gate AND1 is "1", the output of the and gate AND 3 correspondsto the output of the flag F15, which is set when the minimum comparisondata can not be obtained even if the outputs of the first block I, thesecond block II and the third block III of the standard photo sensorarray 14 are used. In other words, the set state of the flag F15represents that the previous focus detection was made under undesiredcondition. When the output of the and gate AND1 is "1", with the setstate of the flag F15, the output of the and gate AND3 is "1", whilewith the reset state of the flag F15, the output of the and gate AND3 is"0". The and gate AND 3 acts the judgement in the step S17.

Referring to FIG. 5(a) again, in a case where the output of the and gateAND1 is "1" with "1" of the flag F15, the output of the and gate AND3 is"1" and the output of an inverter INV1 is "0", whereby the and gate AND4is disabled. With "1" output of the and gate AND4, the output of the andgate AND5 corresponds to the state of the flag F3. With the set state ofthe flag F3, the output of the and gate AND5 becomes "1", causing theoutput of the or gate OR1 to be "1". If the flag F3 is not set, theoutput of the and gate AND5 is "0". The and gate AND5 acts the operationof the step S18.

With "1" output of the and gate AND1 without the flag F15 set, theoutput of the and gate AND3 is "0" causing the output of the inverterINV1 to be "1". Accordingly, with the set state of the flag F4, theoutput of the and gate AND4 is "1", causing the output of the or gateOR1 to be "1". In a case where the flag F4 is not set, the output of theand gate AND4 is "0". The and gate AND 4 acts the operation of the stepS19.

The focus detecting operation is described with reference to the flowchart of FIG. 6. If it is detected that the brightness or contrast ofthe photographic object is not suitable in the steps S13 or S14, theprogram flow goes to the steps S15 and S16 wherein the flag F5 is setand the minimum peak value Y2 is compared with the first judge levela2C2 which is most severe. If the minimum peak Y2 is smaller than a2C2,the minimum comparison data H₂ (n) calculated in the circuit arrangementA is used for the defocus detection. If the minimum peak Y2 is greaterthan a2C2, the program flow goes to the procedure for the focusdetection using the output of the first block I of the photo sensorarray 14. If it is detected in the steps S13 and S14 that the brightnessand contrast of the photographic object is suitable, the program flowgoes to the step S17 for judging whether or not the previous focusdetection was suitable. If it is judged that the previous detection wassuitable, the program flow goes to the step S19 and the minimum peak Y2is compared with the third judge level which is loosest. If the previousfocus detection was not suitable the program flow goes to the step S18for comparison of the minimum peak with the second judge level a3C2. Ifit is judged that Y2 is equal to or smaller than a4C2 in the step S19 orY2 is equal to or smaller than a3C2 in the step S18, the minimumcomparison data H₂ (n) calculated in the circuit arrangement A is usedfor the defocus detection. If it is judged that Y2 is greater than a4C2in the step S19 or Y2 is greater than a3C2, the program flow goes to theprocedure for the focus detection using the output of the first block Iof the standard photo sensor array 14.

Step S20 is provided for counting a predetermined period of time t0. Inthe preferred embodiment of the present invention, the focus detectionis made first using the second block II of the standard photo sensorarray 14, whereby if the result of the detection is not a reliable one,the focus detection is made second using the first block I of thestandard photo sensor array 14. If the result of the detection using thefirst block I is not still a reliable one, the focus detection is madethird using the third block III. In order to spend equal time length forthe focus detection using only the second group II, for the focusdetection using the second and the first group II and I and for thefocus detection using all three groups II, I and III, the step S20 isprovided. Details of the operation of the step S20 and the focusdetection will be explained later.

A terminal T1 in FIG. 5(a) is connected with a focus detection circuit Bfor the focus detection using the first group I of the standard photosensor array 14 and a focus detection circuit C for the focus detectionusing the third block III, whereby the photo cell signals necessary foreach block are transferred.

Output terminals T2, T3 and T5 are connected to an instruction circuitCPU. Output terminal T4 is connected with the circuit block B and C inwhich the judge levels for the minimum peak values Y1 and Y3 aredetermined.

FIG. 11 shows the detail of the focus detection circuit B for the focusdetection using the first block I of the standard photo sensor array 14.The focus detection circuit B can operate only when the minimumcomparison data H₂ (n) can not be obtained using the second block II inthe circuit A shown in FIG. 5. In other words, the circuit B is operatedby the instruction fed from the instruction circuit CPU when the minimumpeak value Y2 is not suitable and the output of the or gate OR1 is "0".

Referring to FIG. 11, an operation circuit 126 calculates the followingequation. ##EQU13## Wherein the suffix 1 means the first block I is usedand N=1, 2, . . . 8.

The circuit block B acts to detect the co-relation between the outputsof the first block I of the standard photo sensor array 14 and theoutputs of the photo cells situated right to photo cell r9 of thereference photo sensor array 16 for detection of the rear focuscondition.

Each comparison data H₁ (N) calculated by the circuit B is stored in amemory circuit 128 together with the shift value N. The minimumcomparison data H₁ (n) among the eight comparison data thus calculatedis stored in a memory circuit 132 as shown in the step S22 in FIG. 12.

Subsequently, the following equation is calculated in a calculationcircuit 134 for detection of the image interval with a accuracy finerthan the pitch of a pair of two adjacent photo cells. ##EQU14##

The result of the calculations (25) and (26) is stored in a memorycircuit 136. Using the result of the calculations as mentioned above,the minimum peak value Y1 for the first group I can be calculated in acalculation circuit 138.

The minimum peak value Y1 thus calculated is stored in a memory circuit140 in the steps S23 and S24. The circuit arrangement of the elements126 through 140 shown in FIG. 11 is similar to the circuit arrangementformed by the elements 26 through 40 in FIG. 5(a) and the operationsteps S21 through S24 shown in FIG. 12 correspond to the steps S8through S11 in FIG. 6.

A contrast detection circuit 124 operates to calculate the followingequation (27) similar to the contrast detection circuit 42 in FIG. 5(a)for detection of the contrast of the photographic object. ##EQU15##

The result of the equation (27) represents the sum of the absolute valueof each difference between the respective two adjacent photo cells. Thecontrast data C1 calculated by the equation 27 is stored in a memorycircuit 144. The contrast data C1 is fed to a calculation circuit 148 inwhich each contrast data is multiplied with the constants a2, a3 and a4respectively so as to decide the judge levels a2C1, a3C1 and a4C1 forthe minimum comparison data Y1 in a similar manner as described withreference to the calculation circuit 48 shown in FIG. 5(a). The judgelevels a2C1, a3C1 and a4C1 are fed to a comparison circuit 150 forcomparing with the minimum peak value Y1. In case of Y1≧a2C1, a flag F7is set, in case of Y1≧acC1, a flag F8 is set and in case of Y1≧a4C1, aflag F9 is set.

The contrast data C1 is fed to a comparator 146 for comparing with theconstant a5 in a similar manner as performed in the comparator 46 shownin FIG. 5(a), whereby in case of C1≧a5, a flag F10 is set in the stepS26 in FIG. 12.

In place of using the constant a5, another constant ##EQU16## which isthe multiplication of the value a5 with the ratio of the number of photocells of the second block II and the first block I may be used.

The circuit arrangement shown in the right lower half portion of FIG. 11is provided for executing the operation of the steps S27 through S31 inFIG. 12. In a case where the flag F10 is not set with the contentthereof to be "0", or the flag F10 is set to "1" with the flag F6connected to the terminal T4 to be "0", an output of an and gate AND6 is"0", so that the output of a nand gate NAND2 is "1". Accordingly if aflag F7 is "1", the output of an and gate AND 7 is "1" and the output ofan or gate OR2 is "1". If the flag F7 is "0", the output of the and gateAND7 is "0". The and gate AND6 performs the judgement of the step S27and the and gate AND7 performs the judgement of the step S28. If both ofthe flags F6 and F10 are "1", the output of an and gate AND8 correspondsto the state of the flag F15 which is connected with a terminal T13. Ifthe flag F15 is "1", the output of the and gate AND8 is "1" and an andgate AND10 is enabled with an and gate AND9 to be disabled. The outputof the and gate AND10 corresponds to the state of the flag F6. Thus theand gate AND10 performs the judgement of the step S30. With "0" of theflag F15, the output of the and gate AND6 is "0", whereby an and gateAND9 is enabled by the output of an inverter INV7. Since the output ofthe and gate AND 9 corresponds to the content of the flag F9, the andgate AND9 operates the step S31 in FIG. 12. An and gate AND8 acts toalternatively selectively enable any one of the and gates AND9 and AND10in the step S28.

When the output of any one of the and gates AND7, AND9 and AND10 is "1",the output of the or gate OR2 is also "1", the the program flow goes tothe step S32 to count the predetermined period of time t1 which isshorter than the time t0 in the step S20. The lengths of the times t0and t1 are so defined as to spend equal period of time for obtaining thesuitable minimum comparison data H₂ (n) by using the steps S8 throughS19 and for obtaining the suitable minimum comparison data H₁ (n) usingfrom any one of the steps S16, S18, S19 to the step S31 through the stepS21 and for obtaining the suitable minimum comparison data H₃ (n) byusing the steps S43.

Output terminals T7 and T8 are respectively connected with theinstruction circuit CPU so as to transfer the data H₁ (n), n, h₁ (n-1)and h₁ (n+1) to the circuit CPU. An output terminal T9 is also connectedwith the instruction circuit CPU. With a signal "1" of the terminal T9,the data transferred through the terminals T7 and T8 are employed forthe image interval calculation. With the signal "0" of the terminal T9,the circuit C is enabled so as to executing the focus detection usingthe third block III.

The circuit C is used when there can not be obtained the reliable resultof H₂ (n) and H₁ (n) by the operation of the circuit A using the secondblock II and the first block I. In other words, the circuit C is enabledaccording to the instruction fed from the instruction circuit CPU onlywhen it is judged that the minimum peak Y1 is not suitable.

In FIG. 13, a calculation circuit 226 corresponds to the operation ofthe calculation circuit 26 of the circuit arrangement A, calculating thefollowing equation in the step S33. ##EQU17## The suffix 3 in H₃ (N)means that the third block III is used and N=1,2,3, . . . 8. Thus, thecircuit C calculates the co-relation of the output of the third blockIII and the output of the photo cells left to the photo cell r23. Inother words, the focus detection using the third block III is made undersuch case that the image interval is narrower than such case that thefocus occurs on the predetermined focused plane, i.e., the detectionusing the third block III is made of the front focus condition.

Each data H₃ (N) calculated in the calculation circuit 226 is stored inthe memory circuit 228 with the shift value N similar to the operationperformed in the circuit A, the minimum data H₃ (n) among the eightcomparison data can be detected by a minimum value detection circuit230, in turn the minimum data H₃ (n) is stored in a memory circuit 232with the minimum shift value n in the step S34.

Following equations are calculated by a calculation circuit 234 fordetecting the image interval with a finer accuracy. ##EQU18## Using thedata h₃ (n-1) and h₃ (n+1), the minimum peak value Y3 for the thirdblock III is calculated in a calculation circuit 238. The minimum peakvalue Y3 is stored in a memory circuit 240 in the steps S35 and S36.

The circuit arrangement formed by elements 226 through 240 is similar tothe arrangement formed by the elements 26 through 40 in the circuitshown in FIG. 5 and the operation thereof represented by the steps S33through S36 corresponds to the operation shown in the steps S8 throughS11.

A contrast detection circuit 242 calculates the following equation in asimilar manner as operated in the contrast detection circuit 42 forobtaining the contrast value C3 in the step S37. ##EQU19##

The contrast value C3 represents the output difference between the twoadjacent photo cells in the third block III of the standard photo sensorarray 14. The calculated contrast value C3 is stored in a memory circuit244.

The contrast data C3 is fed to a calculation circuit 248 in which eachcontrast data is multiplied with the constants a2, a3 and a4respectively so as to decide the judge levels a2C3, a3C3 and a4C3 forthe minimum comparison data Y3 in a similar manner as described withreference to the calculation circuit 48 shown in FIG. 5. The judgelevels a2C3, a3C3 and a4C3 are fed to a comparison circuit 250 forcomparing with the minimum peak value Y3. In case of Y3≦a2C3, a flag F11is set, in case of Y3≦a3C3, a flag F12 is set and in case of Y3≦a4C3, aflag F13 is set.

The contrast value C3 is fed to a comparator 246 for comparing with theconstant a5 in a similar manner as performed in the comparator 46 shownin FIG. 5, whereby in case of C3≧a5, a flag F14 is set in the step S38in FIG. 14.

In place of using the constant a5, another constant ##EQU20## which isthe multiplication of the value a5 with the ratio of the number of photocells of the second block II and the first block I may be used.

The circuit arrangement shown in the right lower half portion of FIG. 13is provided for executing the operation of the steps S38 through S44 inFIG. 14. In a case where the flag F14 is not set with the contentthereof to be "0", or the flag F14 is set to "1" with the flag F6connected to the terminal T4 to be "0", an output of an and gate AND11is "0", so that the output of a nand gate NAND3 is "1". Accordingly if aflag F11 is "1", the output of an and gate AND 12 is "1" and the outputof an or gate OR3 is "1". If the flag F11 is "0", the output of the andgate AND12 is "0". The and gate AND11 performs the judgement of the stepS29 and the and gate AND12 performs the judgement of the step S40. Ifboth of the flags F6 and F14 are "1", the output of an and gate AND13corresponds to the state of the flag F15 which is connected with aterminal T17. If the flag F15 is "1", the output of the and gate AND13is "1" and an and gate AND15 is enabled with an and gate AND14 disabled.The output of the and gate AND15 corresponds to the state of the flagF12. Thus the and gate AND15 performs the judgement of the step S42.With "0" of the flag F15, the output of the and gate AND13 is "0",whereby an and gate AND14 is enabled by the output of an inverter INV3.Since the output of the and gate AND14 corresponds to the content of theflag F17, the and gate AND14 operates the step S43 in FIG. 13. An andgate AND13 acts to alternatively selectively enable any one of the andgates AND14 and AND15 in the step S41 depending on the output of theflag F15.

When the output of any one of the and gates AND12, AND14 and AND15 is"1", the output of the or gate OR3 is also "1", the the program flowgoes to the step S45.

In a case where the outputs of the and gates AND12, AND14 and AND 15 areall "0", the output of the or gate OR3 is "0" and the flag F15 is set bythe output of the inverter INV4. The flag F15 is set by "1" in a casewhere any reliable minimum comparison data is not obtained even if allof the circuits A, B and C are used, whereby the state of the flag F15is used for selecting the severe judge level cf the minimum peak valuein the subsequent calculation operation.

It is noted that the steps for counting the period of time correspondingto the steps S20 in FIG. 6 and S32 in FIG. 12 are omitted in theoperation shown in the steps S33 through S44 of the circuit C becausethe respective periods of time for a first case in which the reliableminimum comparison data can be obtained by the operation performed bythe steps S1 through S20, for a second case in which the reliableminimum comparison data can be obtained by the operation performed bythe steps S1 through S32, for a third case in which the reliable minimumcomparison data can be obtained by the operation performed by the stepsS1 through S43 and for a fourth case in which the reliable minimumcomparison data can not be obtained even if the operation is performedfrom the step S1 to the step S44 are defined by the same time length.

The advantage of equalizing the respective time lengths of the firstcase through third case as mentioned above is in that the period of timewhen the integration of the output of the CCD sensor array 14 or 16 iscompleted can be adjusted to the period of completion of the calculationof the minimum comparison data in the respective first through thirdcases.

Terminals T11 and T12 in FIG. 13 are connected with the instructioncircuit CPU in FIG. 15 so as to transfer the data H₃ (n), n, h₃ (n-1)and h₃ (n+1) to the instruction circuit CPU. A terminal T14 is alsoconnected to the instruction circuit CPU, whereby with "1" of the signalon the terminal T14, data transferred from terminals for transferringthe result of calculation of the image interval is taken in theinstruction circuit CPU and with "0" of the signal on the terminal T14another operation described later is performed.

A circuit arrangement D shown in FIG. 15 is provided for controlling thecircuits A,B and C and for calculating the amount of the defocus of thephotographic lens and the direction of the defocus on the basis of theminimum comparison data H₂ (n), H₁ (n) and H₃ (n) and the minimum shiftvalue n. The instruction circuit CPU receives the minimum comparisondata H₂ (n) and the minimum shift value n from the circuit A through theterminals T2 and T3 and the signal representing whether the minimumcomparison data H₂ (n) is reliable through the terminal T5. Theinstruction circuit CPU transfers the data H₂ (n) to a calculationcircuit 300 as H_(i) (n) when the terminal T5 is "1" which means theminimum comparison data H₂ (n) is reliable. With "1" of the terminal T5,the data h₂ (n-1) and h₂ (n+1) are transferred to the calculationcircuit 300 and a comparator 302 from the instruction circuit CPU.Furthermore, with "1" on the terminal T5, the instruction circuit CPUenables a counter CO to count the time t0 for operation of the procedureof the step S20.

"1" of the terminals T9 and T14 of the circuits B and C represents theminimum comparison data H₁ (n) or H₃ (n) is reliable. In a case wherethe terminals T9 or T14 is "1",the reliable minimum comparison data H₁(n) or H₃ (n) is input to the calculation circuit 300 from theinstruction circuit CPU, enabling the counter CO for counting the timet1 so as to operating the procedure of the step S22.

As mentioned above, the instruction circuit CPU inputs the reliableminimum comparison data H_(i) (n) to the calculation circuit 300.Furthermore, the data h_(i) (n-1) and h_(i) (n+1) corresponding to thedata H_(i) (n) (i=1, 2 or 3) are input to the comparator 302 and thecalculation circuit 300. The comparator 302 compares the two data h_(i)(n-1) and h_(i) (n+1) and the result of the comparison is fed to thecalculation circuit 300 as shown in the step S45 in FIG. 14.

The calculation circuit 300 calculate the any one of the followingequations (32) and (33) depending on the result of the comparison forcalculating the interpolation ##EQU21##

The shift value X thus obtained represents the minimum interpolationshift value that is the minimum shift value finer than the pitch betweenthe two adjacent photo cells.

FIG. 16(a) is a graph showing the shift value taken on the horizontalaxis vs the comparison data taken on the vertical axis in case of h_(i)(n-1)≧h_(i) (n+1). In order to obtain the shift value with the highestcoincidence between n-1 and n or n and n+1, a gradient of a line f1 inthe intermediate position Q1 between n-1 and n is considered. f1 is aline connecting the point h_(i) (n-1) and the point H_(i) (n). Thegradient is expressed by H_(i) (n)-h_(i) (n-1). A gradient at theintermediate point Q2 of a line f2 connecting points Hi(n) and hi(n+1)is he(n+1)-Hi(n). FIG. 16(b) shows the both gradients by the points V1and V2. A line f3 connecting the points V1 and V2 is depicted and apoint V3 is a cross point of the line f3 with the horizontal axis. Theshift value up to the point V3 is defined as the minimum interpolationshift value X. The minimum interpolation shift value X can be obtainedby the equations (32) or (33) selected depending on the relation of themagnitude of hi(n-1) and hi(n+1). The minimum interpolation shift valueX is stored in a memory circuit 304. A displace value P between theimage on the standard photo sensor array 14 and the image on thereference photo sensor array 16 is calculated in the calculation circuit306 by the following equation (34) using the minimum interpolation shiftvalue X.

    P=Z1-Z2-Z3+X-1                                             (34)

In the equation (34), Z1 is a length L1 between the photo cell l1 andthe photo cell r1, Z2 is the image interval L2 which is the lengthbetween the photo cells l12 and r16 in case of the in-focus conditionand Z3 is a constant which is defined depending on which minimumcomparison data for the first block through third block is used. In thepreferred embodiment, Z1=4, Z2=8 and Z3 is -8 in a case where the firstblock I is used, 0 in a case where the second block II is used and 7 ina case where the third block III is used. By defining Z1 though Z3 asmentioned above, P is 0 in case of the in-focus condition, P is smallerthan 0 in case of the front focus condition and P is greater than 0 incase of the rear focus condition. Thus, the displacement P can beobtained by the minimum interpolation shift value X. FIG. 17 shows therelation between the minimum interpolation shift value X and thedisplacement X. The upper number line in FIG. 17 represents the minimuminterplation shift values in the respective blocks I, II and III and thelower number line represents the displacement values P in the element toelement pitch basis. For example, in a case where minimum interpolationvalue X is 5 for the second block II, P=4-3-0+5-1=0 which shows thein-focus condition.

In a case where the minimum interpolation value X is 6 for the firstblock I,

    P=4-3+8+6-1=9

and in a case where X is 4 for the third block III,

    P=4-8-7+4-1=8,

whereby the front focus condition or rear focus condition can bedetected.

The values Z1 through Z3 are stored in a memory circuit 308 shown inFIG. 15, from which the values Z1 and Z2 are read out and fed to acalculation circuit 306 with the value Z3 selected by the instructioncircuit CPU corresponding to which blocks I to III is used for obtainingthe minimum comparison data Hi(n).

The displacement value P thus calculated is input to a comparator inwhich the sign of +and -of the displacement value is detected in thestep S49 shown in FIG. 14. In case of P≦0, a flag F17 is set to "1" inthe step S50. In case of P≧0, the flag F17 is "0". The content of theflag F17 represents the direction of the defocus with reference to thepredetermined focal plane, so that if the in-focus condition or frontfocus condition is detected the flag F17 is "1" and when the rear focuscondition is detected, the flag F17 is "0". The signal of the flag F17is fed to a motor drive circuit 420 shown in FIG. 18 for driving a lensmotor to control the direction of rotation of the lens motor.

The calculated displacement value P is fed to a defocus calculationcircuit 312 shown in FIG. 15 in which the value P is multiplied with aconstant a6 stored in the memory circuit 314, whereby the defocus valueDF can be obtained. The constant a6 is defined for converting thedisplacement value P of the two image projected on the photo sensorarrays 14 and 16 placed extending in a vertical direction against theoptical axis into the defocus value on the predetermined focal plane inthe optical axis. The constant a6 can be defined depending on thedistance between the photo sensor arrays 14, 16 and the predeterminedfocal plane, the magnification ratio of the condenser lens and reimageforming lenses. The defocus value DF thus calculated is stored in amemory circuit 316, and the stored defocus value DF is fed to the motordrive circuit 420 for controlling the rotating amount of the lens motor.

The focus detecting device of the preferred embodiment is so arrangethat the standard photo sensor array 14 is divided into three blocks andthe focus detection is performed using the second block II for the focusdetection near the in-focus position with the priority, then if thefocus detection is not suitable or impossible using the second block II,the other blocks I or III is used for the focus detection. Accordingly,the circuit arrangement is simple compared with the conventional devicein which the focus detecting is made for the various blocks then it isjudged that which focus detection is most suitable. Furthermoreaccording to the present invention, it is able to detect the in-focuscondition in case of the photographic object has a repetitively patternhaving a predetermined relation with the pitch of adjacent two photocells. Furthermore, if the focus detection using the second block isimpossible the first block I or third block III is used, a means forjudging whether or not the result of the focus detection is correct canbe omitted.

FIG. 18 shows one example of the circuit arrangement in which a microcomputer is used for calculation of the focus condition as describedabove. Referring to FIG. 18, when a pressure of a shutter release buttonof a camera is detected by a microcomputer μ-com, an AF switch AF isclosed for starting the focus control. A pulse like clear signal ICG forclearing the result of integration is fed to CCD photo sensor arrays404, the contents of the photo cells of the CCD photo sensor arrays arereset and the output AGCOS of a brightness monitor circuit MC can berecovered to the power source voltage level. Also the microcomputerμ-com produces signal SHEN of a high level for allowing the productionof shift pulses SH. When the clear signal ICG for clearing theintegration diminishes, the CCD 404 starts the integration of the photocurrent in the CCD and the output of the brightness monitor circuit MCbegins to decrease with a speed depending on the brightness of objectwhile the standard signal DOS from a standard signal generator RS iskept to a constant standard level. An AGCO controller 406 compares thesignal AGCOS with the standard signal DOS to control the gain of adifferential amplifier 408 depending what degree of the output of theAGCOS decreases against the signal DOS during a predetermined timelength. After the integration clear signal ICG is diminished, when theAGC controller 406 detects that the signal AGCOS is decreased lower thana predetermined level relative to the value of the signal DOS within thepredetermined time length, the AGC controller 406 produces a signal TINTof high level. The signal TINT is fed to a shift pulse generator 410through an and gate AN and an or gate OR, whereby the shift pulsegenerator 410 provides a shift pulse SH. When the shift pulse SH isinput to the CCD 404, the integration of the respective photo cells isfinished and the charge corresponding to the intergrated value istransferred to a shift register of the CCD 404 corresponding to each ofthe photo cells in a parallel manner. On the other hand two sensor drivepulse trains φ1 and φ2 output of phase of 180° are fed to the CCD 404from a sensor drive pulse generator 412 based on the clock pulses fromthe microcomputer μ-com. The CCD 404 outputs the charges in therespective cell of the CCD shift register one by one from one end insynchronism with the positive edge of the pulses φ1 so as to produce thevoltage OS which forms the video signal. It is noted the higher thevoltage OS, the lower the intensity of light projected to the photocells. The voltage OS is subtracted by the standard voltage DOS, therebyoutputting the photo cell signal (DOS-OS).

If a predetermined time is lapsed without outputting the signal TINTafter the intergation clear signal ICG is diminished, the microcomputerμ-com generates an instruction signal SHM for generation of the shiftpulse SH. Accordingly, when the signal TINT is not generated from theAGC controller 406 after the predetermined time is lapsed from theperiod when the clear signal ICG is diminished, the shift pulsegenerator 410 generates a shift pulse SH.

On the other hand, when the outputs from the seventh to tenth photocells are produced, the microcomputer generates a sample hold signalS/H, whereby a peak hold circuit 416 holds the difference between thesignal OS of the part of the photo cells covered by an aluminum mask andthe signal DOS and thereafter the difference signal and the photo cellsignals are input to the differential amplifier 408. The differencebetween the photo cell signal and the difference signal is amplifiedwith the gain controlled by the AGC controller 406 and then the outputof the differential amplifier is digitized by the A/D converter 418 andthe digitized data is fed to the microcomputer μ-com.

By depression of the shutter release button by one step, the clearsignal ICG for clearing the integration is generated and at the timewhen the clear signal ICG is diminished, the integration of the photocells of the CCD arrays begins, the maximum time of the microcomputerμ-com for this integration is 100 msec. If the brightness of the objectis higher than a predetermined level, the signal AGCOS decreases by 2.8volt against the signal DOS until 100 msec are lapsed, so that themicrocomputer μ-com generates the signal TINT and the gain controlsignal for controlling the gain of the differential amplifier 408.

If the brightness of the object is lower than the predetermined level,the signal AGCOS is not decreased against the signal DOS by more than2.8 volts during 100 msec after the signal ICG is diminished, then themicorcomputor -com generates the signal SHM at the time when 100 msec islapsed and the gain control signal is generated from the AGC controller406. In this case the AGC controller 406 judges that the integrationtimes 100 to 200 msec, 200 to 400 msec, 400 to 800 msec or more than 800msec is necessary depending on the degree of decrement of the signalAGCOS within 100 msec. Then the AGC controller 406 provides a gainsetting signal to set the gain of the differential amplifier 408 in anyone of the gains 1, 2, 4 and 8. In this case the signal TINT is notgenerated.

The video signals are fed to the microcomputer μ-com from the A/Dconverter 418 and the focus detection circuit 424 stores the respectivevideo signals and defocus value and direction is calculated in thecircuit 424 in a manner described above for controlling the focusedcondition of the photographic lens 430.

In place of taking the outputs of each of the photo cells l1 through l23and r1 through r31, a subtraction of the output of the photo cell l1 bythe output of the photo cell l5 may be used as the output of the photocell l3, similarly a subtraction of the output of the photo cell l2 bythe output of the photo cell l6 may be used as the output of the photocell l4. In general the subtraction of the output of one photo cell byanother output of photo cell apart from a suitable number of the photocell may be used as the output of the photo cell situated at the centerbetween the one photo cell and another photo cell. Using this method,the high frequency component of the image can be eliminated.

FIG. 5(b) shows the circuit arrangement for processing the signals asdescribed above. The output signals S1 of the A/D converter 20 areapplied to a subtract circuit S' in which the signals S1 fed from theA/D converter 20 are partly fed to a subtract circuit and partly to adelay circuit. The delay circuit acts to delay the signals S1 by a timelength corresponding to the time necessary for transferring the signalby four photo cells of the photo sensor array 14, then outputs thesignal S2. By this arrangement, the subtract circuit subtracts thesignals S1-S2. The output signal of the subtract circuit represents thedifference between the output of one photo cell (for example photo celll1) and another output of a photo cell apart by four cells (four examplethe photo cell l5). Thus the output of the subtract circuit representsthe difference of the output signals of the photo cells l1 and l5. Asimilar operation can be performed for the respective photo cells.

What is claimed is:
 1. A focus detection system for detecting the focuscondition of an objective lens, comprising:optical means for formingdisplaced first and second images; first and second sensors positionedto receive the first and second images for generating first and secondimage signals, the first and second sensors being composed of aplurality of photocells for generating a plurality of image elementoutput signals, respectively; weighting means for reducing image elementoutput signal levels representative of opposing ends of the first andsecond images relative to the remaining image element output signals;calculating means for calculating a correlation between portions of therespective image signals including the weighted signals while repeatedlyshifting one image signal relative to the other image signal by apredetermined pitch to provide a correlation value for each shift, anddefocus calculating means for calculating the amount of defocus of theobjective lens in accordance with one correlation value.
 2. The focusdetection system of claim 1, wherein the weight giving means includesmeans for reducing the image element output signals of the opposing endsof the first and second images by one half.
 3. A focus detection systemfor detecting the focus condition of an objective lens,comprising:optical means for forming displaced first and second images;first and second sensors positioned to receive the first and secondimages for generating first and second image signals, the first andsecond sensors being composed of a plurality of photocells forgenerating a plurality of image element output signals, respectively;calculating means for calculating a correlation between image signaloutput levels representative of the first and second sensors, thecalculation means comprising means for shifting a predetermined portionof the first image signal relative to the second image signal by apredetermined pitch, comparing each of the elements of the thus shiftedportion of the first signal to corresponding elements in the secondsignal to provide a comparison signal for each shift, reducing signallevels of opposing ends of each resulting comparison signal, andcalculating a single correlation value representative of each comparisonsignal; defocus calculating means for calculating the amount of defocusof the objective lens in accordance with one correlation value.
 4. Amethod for detecting the focus condition of an objective lens,comprising:forming displaced first and second images; generating firstand second image signals, each composed of a plurality of image elementsignals, respectively; reducing image signal output levels of opposingends of the first and second image signals; calculating a correlationbetween the reduced image signal output levels while repeatedly shiftingone image signal relative to the other image signal by a predeterminedpitch to provide a correlation value for each shift; finding a bestcorrelation value among the plurality of correlation values; andcalculating the amount of defocus of the objective lens in accordancewit the best correlation value.
 5. The method of claim 4, wherein theimage signal levels of the opposing ends of the first and second sensorsare reduced by one half.
 6. A method for detecting the focus conditionof an objective lens, comprising:forming displaced first and secondimages; generating first and second image signals, the first and secondimage signals being composed of a plurality of element signalsrespectively; calculating a correlation between the first and secondimage signals by comparing the first and second images while repeatedlyshifting one image signal relative to the other image signal by apredetermined pitch to provide a comparison signal for each shift,reducing signal levels of opposing ends of the comparison signals, andproviding a correlation value in accordance with each weightedcomparison signal; finding means for finding a best correlation valueamong the plurality of correlation values; and calculating the amount ofdefocus of the objective lens in accordance with the best correlationvalue.
 7. The focus detection system of claim 6, wherein the opposingends of the comparison signal are reduced by one half.
 8. A focusdetection system for detecting the focus condition of an objectivelens,optical means for forming first and second images of an object;first and second image signal generating means having first and secondsensors positioned to receive the first and second object images andadapted to generate first and second image signals corresponding to thelight intensity distributions of the object images on the first andsecond sensors, said first and second image signals being composed of aplurality of element signals; and correlation calculating means forcalculating correlation between the first and second image signals whilerepeatedly shifting the second image signal relative to the first imagesignal by a given pitch to provide a shifting overlap region and tocalculate a correlation value for each overlap region; the correlationcalculating means also including weight given means for giving weight tothe opposite ends of the overlapped region, wherein the best correlationvalue can be determined for enabling a focus detection.
 9. A focusdetection system for detecting the focus condition of an objectivelens,optical means for forming displaced first and second images of anobject; first and second image signal generating means having first andsecond sensors positioned to receive the first and second object imagesand adapted to generate first and second image signals corresponding tothe light intensity distributions of the object images on the first andsecond sensors, said first and second image signals being composed of aplurality of element signals; and correlation calculating means forcalculating correlation between first and second image signal whilerepeatedly shifting the second image signal relative to the first imagesignal by a given pitch to provide a plurality of shifted overlapregions thereby and to calculate a correlation value for each shiftedoverlap region; the correlation calculating means also including weightgiving means for giving weight to the opposite ends of the overlappedregion, wherein the best correlation value can be determined forenabling a focus detection.